#include <func.h>

void *func(void *p)
{
    while(1);
    printf("child thread wake up!\n");
    pthread_exit(NULL);
}

int main(int argc,char **argv)
{
    pthread_t pthid;
    int ret;
    ret = pthread_create(&pthid,NULL,func,NULL);
    THREAD_ERROR_CHECK(ret,"pthread_create");
    ret = pthread_cancel(pthid);
    THREAD_ERROR_CHECK(ret,"pthread_cancel");
    long threadRet;
    ret = pthread_join(pthid,(void**)&threadRet);
    THREAD_ERROR_CHECK(ret,"pthread_join");

    printf("child exit code:%ld",threadRet);

    return 0;
}

